﻿<%@ Page Language="C#" MasterPageFile="../Shared/Website.Master" Inherits="System.Web.Mvc.ViewPage<CommentViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div id="left">
        <div class="m">
            <h2>
                <strong>商品信息</strong>
            </h2>
            <div class="c">
                <ul>
                    <li class="ip"><a href="<%=Url.Action("PreView", "Product", new { ProductId = Model.Product.ProductId }) %>">
                        <img alt="" onerror="this.src='<%=Url.Content("~/WebResources/Images/None_150.gif") %>'"
                            src="<%=Url.Content(string.Format("~/{2}/{0}/s_{1}", Model.Product.ProductId, Model.Product.ImageName, Model.ImageRoot)) %>" /></a>
                    </li>
                    <li>商品名称：<%=Html.ActionLink(Model.Product.SubName, "PreView", "Product", new { ProductId = Model.Product.ProductId }, null) %></li>
                    <li>零售价格：<del class="fontBold colorBlue"><%=Model.Product.Price%></del></li>
                    <li>优惠价格：<strong class="colorOrange"><%=(Model.Product.Price * (decimal)Model.Product.DisCount).ToString("0.00")%></strong></li>
                    <li>评论得分：<img src="<%=Url.Content(string.Format("~/WebResources/Images/Gv{0}.jpg", (int)Model.Product.GradeValue)) %>"
                        alt="" />
                        (<%=Model.Product.GradeValue %>
                        分)</li>
                    <li>评论数量：<%=Model.CommentCountList[0].Sum %>
                        条</li>
                    <li class="ic"><a href="javascript:void(0)" onclick="AddToCar(<%=Model.Product.ProductId %>)">
                        <img src="<%=Url.Content("~/WebResources/Images/AppendToCart.jpg") %>" alt="" /></a></li>
                </ul>
            </div>
        </div>
    </div>
    <div id="right">
        <div class="sort">
            <div>
                排序方式：</div>
            <div class="dd1">
                <a href="<%=Model.SortDict[CommentSortFieldNames.Newest] %>" class="viewindex">最新</a>
                <a href="<%=Model.SortDict[CommentSortFieldNames.Reply] %>" class="viewindex">回复</a>
            </div>
            <div>
                评论筛选：</div>
            <div class="dd2">
                <a href="<%=Model.SearchDict[CommentGradeValues.All] %>" class="viewindex">全部评论</a>
                <a href="<%=Model.SearchDict[CommentGradeValues.Five] %>" class="viewindex">5分</a>
                <a href="<%=Model.SearchDict[CommentGradeValues.Four] %>" class="viewindex">4分</a>
                <a href="<%=Model.SearchDict[CommentGradeValues.Three] %>" class="viewindex">3分</a>
                <a href="<%=Model.SearchDict[CommentGradeValues.Two] %>" class="viewindex">2分</a>
                <a href="<%=Model.SearchDict[CommentGradeValues.One] %>" class="viewindex">1分</a>
            </div>
            <div class="dd3">
                <strong><a href="<%=Url.Action("CommentEdit", "Comment", new { productId = Model.CommentParams.ProductId }) %>">
                    [发表评论]</a></strong>&nbsp;&nbsp;&nbsp;&nbsp;共<strong><%=Model.RowsCount %></strong>条评论
            </div>
        </div>
        <div id="divComment">
            <% Html.RenderPartial("List", Model); %>
        </div>
        <div class="pager divPager2">
            <%=Html.Pager(Model.Pager) %>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <%=Html.HtmlTitle(Model.Product.SubName, Model.Product.KeyWords, Model.Product.Description)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
    <link rel="Stylesheet" type="text/css" href="<%=Url.Content("~/Css/Website/Comment.css") %>" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/Common/Common.js")%>"></script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        function AddToCar(productId) {
            $.post('<%= Url.Action("AddToCar","ShopCar") %>', {
                ProductId: productId, count: 1, rnd: Math.random()
            }, function (result) {
                result = $(result);
                window.CloseDialog = function () { result.dialog("close") };
                result.dialog({ width: 500, modal: true, closeText: "×",
                    close: function () { $(this).dialog("destroy") }
                });
                ReLoadMiNiCar();
            });
        }
        $(function () {
            var s = parseInt('<%=(int)Model.CommentParams.SortFieldName - 1 %>');
            var f = Math.abs(parseInt('<%=(int)Model.CommentParams.GradeValue - 6 %>'));
            $(".dd1 a").eq(s).addClass("viewindex_curr");
            $(".dd2 a").eq(f > 5 ? 0 : f).addClass("viewindex_curr");
        });
    </script>
</asp:Content>
